import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '测站编码',
    align:"center",
    dataIndex: 'stcd'
   },
   {
    title: '测站名称',
    align:"center",
    dataIndex: 'stnm'
   },
   {
    title: '所属行政区划',
    align:"center",
    dataIndex: 'addvcd'
   },
   {
    title: 'num',
    align:"center",
    dataIndex: 'num'
   },
   {
    title: '时间',
    align:"center",
    dataIndex: 'tm',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '时段降雨量',
    align:"center",
    dataIndex: 'drp'
   },
   {
    title: '时段长',
    align:"center",
    dataIndex: 'intv'
   },
   {
    title: '降水历时',
    align:"center",
    dataIndex: 'pdr'
   },
   {
    title: '日降雨量',
    align:"center",
    dataIndex: 'dyp'
   },
   {
    title: '天气状况',
    align:"center",
    dataIndex: 'wth'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '测站编码',
    field: 'stcd',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入测站编码!'},
          ];
     },
  },
  {
    label: '测站名称',
    field: 'stnm',
    component: 'Input',
  },
  {
    label: '所属行政区划',
    field: 'addvcd',
    component: 'Input',
  },
  {
    label: 'num',
    field: 'num',
    component: 'InputNumber',
  },
  {
    label: '时间',
    field: 'tm',
    component: 'DatePicker',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入时间!'},
          ];
     },
  },
  {
    label: '时段降雨量',
    field: 'drp',
    component: 'Input',
  },
  {
    label: '时段长',
    field: 'intv',
    component: 'Input',
  },
  {
    label: '降水历时',
    field: 'pdr',
    component: 'Input',
  },
  {
    label: '日降雨量',
    field: 'dyp',
    component: 'Input',
  },
  {
    label: '天气状况',
    field: 'wth',
    component: 'Input',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}